package com.sun.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/index")
public class Demo {

    @RequestMapping("/test01")
    public String test01(){
        System.out.println("this is test01");
        return "forward:/hello1.jsp";
    }

    @RequestMapping("/test02")
    public String test02(){
        System.out.println("this is test02");
        //转发到一个请求方法（同一个控制器类可以省略控制器路径/index/）
        return "forward:/index/test01";
    }

    @RequestMapping("/test03")
    public String test03(){
        System.out.println("this is test03");
        return "redirect:/hello1.jsp";
    }

    @RequestMapping("/test04")
    public String test04(){
        System.out.println("this is test04");
        return "redirect:test03";
    }
}
